-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure no description changes are lost #41370
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Jonathan Boivin <djon2003@hotmail.com>
Maybe should I implement also for ALTREP like nextcloud/tasks#1916 ? |
|
||
// Obtain previous version | ||
$node = $this->server->tree->getNodeForPath($request->getPath()); | ||
$oldObj = Reader::read($node->get()); |
Check failure
Code scanning / Psalm
UndefinedInterfaceMethod Error
// If all description fields are present, then verify consistency | ||
if ($hasAllDesc) { | ||
// Get descriptions | ||
$oldDescription = (string) $oldObj->VTODO->DESCRIPTION; |
Check failure
Code scanning / Psalm
UndefinedPropertyFetch Error
if ($hasAllDesc) { | ||
// Get descriptions | ||
$oldDescription = (string) $oldObj->VTODO->DESCRIPTION; | ||
$newDescription = (string) $vCal->VTODO->DESCRIPTION; |
Check failure
Code scanning / Psalm
UndefinedPropertyFetch Error
// Get descriptions | ||
$oldDescription = (string) $oldObj->VTODO->DESCRIPTION; | ||
$newDescription = (string) $vCal->VTODO->DESCRIPTION; | ||
$oldXAltDesc = (string) $oldObj->VTODO->{$xAltDescPropName}; |
Check failure
Code scanning / Psalm
UndefinedPropertyFetch Error
$oldDescription = (string) $oldObj->VTODO->DESCRIPTION; | ||
$newDescription = (string) $vCal->VTODO->DESCRIPTION; | ||
$oldXAltDesc = (string) $oldObj->VTODO->{$xAltDescPropName}; | ||
$newXAltDesc = (string) $vCal->VTODO->{$xAltDescPropName}; |
Check failure
Code scanning / Psalm
UndefinedPropertyFetch Error
@@ -632,4 +637,38 @@ | |||
'{DAV:}displayname' => $displayName, | |||
]); | |||
} | |||
|
|||
private function ensureDescriptionConsistency(RequestInterface $request, VCalendar $vCal, &$modified) { |
Check notice
Code scanning / Psalm
MissingReturnType Note
@@ -632,4 +637,38 @@ | |||
'{DAV:}displayname' => $displayName, | |||
]); | |||
} | |||
|
|||
private function ensureDescriptionConsistency(RequestInterface $request, VCalendar $vCal, &$modified) { |
Check notice
Code scanning / Psalm
MissingParamType Note
// If all description fields are present, then verify consistency | ||
if ($hasAllDesc) { | ||
// Get descriptions | ||
$oldDescription = (string) $oldObj->VTODO->DESCRIPTION; |
Check notice
Code scanning / Psalm
PossiblyNullPropertyFetch Note
if ($hasAllDesc) { | ||
// Get descriptions | ||
$oldDescription = (string) $oldObj->VTODO->DESCRIPTION; | ||
$newDescription = (string) $vCal->VTODO->DESCRIPTION; |
Check notice
Code scanning / Psalm
PossiblyNullPropertyFetch Note
What's the purpose of the alternate description field? What do clients use it for? I've got some changes I'd like to see but I feel like I'm missing some context here. |
This is similar to nextcloud/calendar#3863 and other issues linked, and as you've mentioned there's more special keys or parameters to handle like I'd say clients are responsible for handling data, and by using them users are responsible for inconsistent data, because we simply can't fix all their mistakes. You should avoid clients that use non-standard properties or parameters ( In any case, this should at least be extracted to a proper "repair" class, apply to VOBJECTs just like VTODOs, and be extensible, not in the scheduling plugin. Or possibly upstreamed directly to Sabre. |
@miaulalala The extra field is used to store the HTML version of the description by many clients. Those clients also manage the description field which is only textual. The issue comes when one uses a mix that includes one of those clients and other textual only clients. In my case: NextCloud, EmClient and OpenTasks. @miaulalala AND @tcitworld Here is a link where all that started for me. https://forum.emclient.com/t/caldav-sync-of-notes-field-in-tasks-does-not-work-properly/76642/37 One of the guys asked for a NextCloud modification and it has been done, but only for the client side not the server side. I agree, this is similar to the issue you mentioned, as I already mentioned it. I'm fixing only the description discrepancy, so I don't think The If you have suggestions for a free Android app that does a great job like OpenTasks, I am open to look at them, but this won't fix the issue, I am quite sure. OpenTasks, even though not maintained anymore, is doing the job correctly by ignoring the "X-ALT-DESC" property, but not EmClient. I already asked them to fix this, but the answer is not as that straight forward as I realized making this change (meaning this PR). In fact, this is a kind of gray zone where every actors in the issue is saying the other shall fix it. Bouncing the ball is clearly not helping the end users. You did not tell me to ask a fix from them, but saying not using it due to that small issue that I corrected was kinda bouncing or "not in my court" behavior. That said, those had only objective to be constructive criticism / opinion. I like the idea of a "repair" class. Because it was the first time I was coding NextCloud, I used reverse engineering to find where my modification could be applied. If you could guide me a bit about the structure and high level tips, I could extract it to another class. My first questions would be:
"Or possibly upstreamed directly to" ==> Not sure to understand. ==> After the correction of your message, I would say, yes, the fix could be incorporated into Sabre directly. |
@miaulalala @tcitworld @blizzz @ChristophWurst I put everyone currently named in the PR because I am not sure who to talk to. I know, it is opensource and people may have not have the time to answer me, but a month had past and I am only sending a little ping. There is a new major version that came out, so while this PR is not merged, I will have to:
That's not so bad. It was only to mention it. So, if anyone of you have some time, I would appreciate your answers to my questions so I could start changing the code to reflect those and to eventually merge this PR. Thank you! |
Oh! Great! I thought you would have give me tips and I would have done it, but it is OK. Few things:
|
Summary
The first resolution was fixing it when using the NextCloud web interface, but not when using an application like OpenTasks on Android. This ensures that the alternate description is deleted if the description is modified alone. So, it better supports application only supporting textual description used in conjonction with others supporting also HTML.
Checklist
I am joining the previous person who solved the issue (@max65482) and the original issue requester (@Gorendal).